<template>
  <div :class="showModal ? 'c-bg-white c-pt30 c-br-tl24 c-br-tr24' : ''">
    <new-search-bar searchFixed="true" bgSearch="c-bg-white c-pt24-i" v-if="!showAll" @search="startSearch" @cancel="startSearch"></new-search-bar>
    <div class="c-bg-white c-pt44 c-pb20" v-if="noHighL && courseName!=''">
      <div class="c-fs28 c-fc-xblack c-text-ellipsis2 c-ph24">{{courseName}}</div>
      <div class="c-fs24 c-fc-gray c-ph24 c-mt24 c-lh40">该内容属于多个频道且不能单独购买，请从以下相关频道进行选购</div>
    </div>
    <div :class="showModal ? 'c-maxh680 c-contexty-auto' : ''">
      <div class="c-fs24 c-fc-xblack c-ph24 c-pv16" v-if="packageList.length>0 && showAll">相关知识套餐</div>
      <div class="c-ph24" :class="(packageList.length>=10)&&(!showAll)?'c-pb80':''">
        <div class="c-flex-row c-pv24 c-bd-b1" @click="clickPackageItem(item.cId)" v-for="(item,index) in packageList" :key="index">
          <div class="c-ww180 c-hh120 c-br10 c-text-hidden c-p">
            <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" imgClass="c-br16" :coverUrl="$addXossFilter(item.cover, require('@/assets/defult270.png'))" />
            <vip-status :item="item"></vip-status>
          </div>
          <div class="c-flex-column c-pl20 c-flex-grow1 c-w0 c-pv4 c-justify-sb">
            <div class="c-fs24 c-text-ellipsis2">{{item.name}}</div>
            <div class="c-flex-row c-aligni-center c-justify-sb">
              <div class="c-fc-xmlred">
                <span v-if="item.payType == 2" class="c-fw600 c-fs20">{{'￥' | iosPriceFilter}}</span>
                <span class="c-fw600" :class="checkCnPrice(item.payType, item.price, 61) ? 'c-fs22' : 'c-fs26'">{{item.payType | priceValueFilter(item.price, 61, item.optimal, 'index')}}</span>
                <span v-if="isShowcrossedPrice(item)" class="c-fs18 c-fc-gray c-text-decoration-through c-ml10">￥{{getCrossedPrice(item)}}</span>
              </div>
              <div class="c-fs20 c-fc-gray" v-if="item.price && item.payType== 2 && (enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(61)))">{{item.sales | formatNumber}}人{{ !$isWxAppIos() ? '已购买' : '观看' }}</div>
              <div class="c-fs20 c-fc-gray" v-else-if="enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(61))">{{(item.visits ? item.visits : item.clicks) | formatNumber}}人观看</div>
            </div>
          </div>
        </div>
        <loading-status-tem :showLoading="isLoading" :noMoreData="((!showAll && is_page == false) || (showAll && is_page_package== false)) && (packageList && packageList.length > 0)" :noData="(!packageList || packageList.length == 0) && (!columnList || columnList.length == 0) && (!mallList || mallList.length == 0) && (!campList || campList.length == 0) && (!circleList || circleList.length == 0)" :noDataText="'暂无结果'"></loading-status-tem>
        <div class="c-pv20 c-textAlign-c c-fc-gray c-fs24" @click="getrelatedComboList()" v-if="showAll && is_page_package">
          加载更多&nbsp;>
        </div>
      </div>
      <div class="c-fs24 c-fc-xblack c-ph24 c-pv16" v-if="columnList.length>0 && showAll">相关专栏</div>
      <div class="c-ph24" :class="(columnList.length>=10 || packageList.length>=10) && showAll?'c-pb80':''">
        <div class="c-flex-row c-pv24 c-bd-b1" @click="clickColumnItem(item.columnId)" v-for="(item,index) in columnList" :key="index">
          <div class="c-ww180 c-hh120 c-text-hidden c-p c-br16">
            <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" imgClass="c-br16" :coverUrl="$addXossFilter(item.cover, require('@/assets/defult270.png'))" />
          </div>
          <div class="c-flex-column c-pl20 c-flex-grow1 c-w0 c-pv4 c-justify-sb">
            <div class="c-fs24 c-text-ellipsis2">{{item.name}}</div>
            <div class="c-flex-row c-aligni-center c-justify-sb">
              <div class="c-fs20" v-if="item.payType == 2 && (enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(9)))">{{item.sales | formatNumber}}{{ !$isWxAppIos() ? '人已购买' : '次观看' }}</div>
              <div class="c-fs20" v-else-if="enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(9))">{{item.clicks | formatNumber}}次观看</div>
              <div v-if="item.isSaleOnly == 0" class="c-fc-xmlred c-fs22">
                关联售卖
              </div>
              <div v-else class="c-fc-xmlred">
                <span v-if="item.price && item.payType == 2" class="c-fw600 c-fs20">{{'￥' | iosPriceFilter(item.optimal)}}</span>
                <span class="c-fw600" :class="checkCnPrice(item.payType, item.price, 9) ? 'c-fs22' : 'c-fs26'">{{item.payType | priceValueFilter(item.price, 9, item.optimal)}}</span>
              </div>
            </div>
          </div>
        </div>
        <loading-status-tem :showLoading="isLoading" :noMoreData="showAll && is_page_column == false && (columnList && columnList.length > 0)"></loading-status-tem>
        <div class="c-pv20 c-textAlign-c c-fc-gray c-fs24" @click="getrelatedColumnList()" v-if="showAll && is_page_column">
          加载更多&nbsp;>
        </div>
      </div>
      <div class="c-fs24 c-fc-xblack c-ph24 c-pv16" v-if="campList.length>0 && showAll">相关训练营</div>
      <div class="c-ph24" :class="(campList.length>=10 || packageList.length>=10) && showAll?'c-pb80':''">
        <div class="c-flex-row c-pv24 c-bd-b1" @click="clickCampItem(item.ttId)" v-for="(item,index) in campList" :key="index">
          <div class="c-ww180 c-hh120 c-text-hidden c-p c-br16">
            <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" imgClass="c-br16" :coverUrl="$addXossFilter(item.cover, require('@/assets/defult270.png'))" />
          </div>
          <div class="c-flex-column c-pl20 c-flex-grow1 c-w0 c-pv4 c-justify-sb">
            <div class="c-fs24 c-text-ellipsis2">{{item.name}}</div>
            <div class="c-flex-row c-aligni-center c-justify-sb">
              <div class="c-fs20" v-if="enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(78))">{{item.people}}人已报名</div>
              <div v-if="item.isSaleOnly == 0" class="c-fc-xmlred c-fs22">
                关联售卖
              </div>
              <div v-else class="c-fc-xmlred">
                <span v-if="item.price && item.payType == 2" class="c-fw600 c-fs20">{{'￥' | iosPriceFilter(item.optimal)}}</span>
                <span class="c-fw600" :class="checkCnPrice(item.payType, item.price, 78) ? 'c-fs22' : 'c-fs26'">{{item.payType | priceValueFilter(item.price, 78, item.optimal)}}</span>
              </div>
            </div>
          </div>
        </div>
        <loading-status-tem :showLoading="isLoading" :noMoreData="showAll && is_page_camp == false && (campList && campList.length > 0)"></loading-status-tem>
        <div class="c-pv20 c-textAlign-c c-fc-gray c-fs24" @click="getrelatedCampList()" v-if="showAll && is_page_camp">
          加载更多&nbsp;>
        </div>
      </div>
      <div class="c-fs24 c-fc-xblack c-ph24 c-pv16" v-if="mallList.length>0 && showAll">相关商品</div>
      <div class="c-ph24" :class="(mallList.length>=10 || packageList.length>=10) && showAll?'c-pb80':''">
        <div class="c-flex-row c-pv24 c-bd-b1" @click="clickMallItem(item.mgId)" v-for="(item,index) in mallList" :key="index">
          <div class="c-ww180 c-hh120 c-text-hidden c-p c-br16">
            <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" imgClass="c-br16" :coverUrl="$addXossFilter(item.avatar, require('@/assets/defult270.png'))" />
          </div>
          <div class="c-flex-column c-pl20 c-flex-grow1 c-w0 c-pv4 c-justify-sb">
            <div class="c-fs24 c-text-ellipsis2">{{item.name}}</div>
            <div class="c-flex-row c-aligni-center c-justify-sb">
              <div class="c-fs20">{{item.sales}}{{ !$isWxAppIos() ? '人已购买' : '人观看' }}</div>
              <div class="c-fc-xmlred">
                <span v-if="item.price" class="c-fw600 c-fs20">{{'￥' | iosPriceFilter(item.optimal)}}</span>
                <span class="c-fw600" :class="checkCnPrice(item.payType, item.price, 13) ? 'c-fs22' : 'c-fs26'">{{item.payType | priceValueFilter(item.price, 12, item.optimal)}}</span>
              </div>
            </div>
          </div>
        </div>
        <loading-status-tem :showLoading="isLoading" :noMoreData="showAll && is_page_mall == false && (mallList && mallList.length > 0)"></loading-status-tem>
        <div class="c-pv20 c-textAlign-c c-fc-gray c-fs24" @click="getrelatedMallList()" v-if="showAll && is_page_mall">
          加载更多&nbsp;>
        </div>
      </div>
      <div class="c-fs24 c-fc-xblack c-ph24 c-pv16" v-if="circleList.length>0 && showAll">相关圈子</div>
      <div class="c-ph24" :class="(circleList.length>=10 || packageList.length>=10) && showAll?'c-pb80':''">
        <div class="c-flex-row c-pv24 c-bd-b1" @click="clickCircleItem(item.id)" v-for="(item,index) in circleList" :key="index">
          <div class="c-ww180 c-hh120 c-text-hidden c-p c-br16">
            <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" imgClass="c-br16" :coverUrl="$addXossFilter(item.avatar, require('@/assets/defult270.png'))" />
          </div>
          <div class="c-flex-column c-pl20 c-flex-grow1 c-w0 c-pv4 c-justify-sb">
            <div class="c-fs24 c-text-ellipsis2">{{item.name}}</div>
            <div class="c-flex-row c-aligni-center c-justify-sb">
              <div class="c-fs20">{{item.people | formatNumber}}人加入</div>
              <div v-if="item.isSaleOnly == 0" class="c-fc-xmlred c-fs22">
                关联售卖
              </div>
              <div v-else class="c-fc-xmlred">
                <span v-if="item.price && item.payType == 2" class="c-fw600 c-fs20">{{'￥' | iosPriceFilter(item.optimal)}}</span>
                <span class="c-fw600" :class="checkCnPrice(item.payType, item.price, 181) ? 'c-fs22' : 'c-fs26'">{{item.payType | priceValueFilter(item.price, 181, item.optimal)}}</span>
              </div>
            </div>
          </div>
        </div>
        <loading-status-tem :showLoading="isLoading" :noMoreData="showAll && is_page_circle == false && (circleList && circleList.length > 0)"></loading-status-tem>
        <div class="c-pv20 c-textAlign-c c-fc-gray c-fs24" @click="getRelatedCircleList()" v-if="showAll && is_page_circle">
          加载更多&nbsp;>
        </div>
      </div>
    </div>
    <nav-bottom-bar :itemIndex="18" v-if="showNavBottomBar"></nav-bottom-bar>
  </div>
</template>

<script>
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import newSearchBar from "@/components/templates/common/newSearchBar.vue"
import NavBottomBar from "@/components/templates/common/navBottomBar.vue";
import vipStatus from '@/components/templates/common/vipStatus.vue'
import CoverImg from '@/components/templates/common/coverImg.vue';
import { utilJs } from "@/utils/common.js"
export default {
  name: "PackageList",
  components: {
    loadingStatusTem,
    NavBottomBar,
    newSearchBar,
    vipStatus,
    CoverImg
  },
  props: {
    showAll: {
      type: Boolean,
      default: false,
    },
    proType: {
      type: Number,
      default: -1,
    },
    proId: {
      type: Number,
      default: -1,
    },
    isExam: {
      type: Number,
      default: 0,
    },
    isTemplate: {
      type: Boolean,
      default: false,
    }
  },
  data() {
    return {
      distributionId: '',
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : "mb5_default",
      themeName: localStorage.getItem("themeName") ? localStorage.getItem("themeName") : "mb5",
      packageList: [],
      columnList: [],
      campList: [],
      showNavBottomBar: false,
      is_page: false,
      is_page_package: false,
      is_page_column: false,
      is_page_camp: false,
      is_page_circle: false,
      page: 1,
      limit: 10,
      pagePackage: 1,
      pageColumn: 1,
      pageMall: 1,
      pageCamp: 1,
      pageCircle:1,
      searchText: '',
      isLoading: false,
      showAll: false, //false:所有套餐的列表   true：关联指定课程、专栏的套餐列表
      proType: -1,
      proId: -1,
      tabType: 1,
      noHighL: false,
      courseName: '',
      cfrom:global.ckFrom,
      companyAuth: localStorage.getItem("companyAuth") ? JSON.parse(localStorage.getItem("companyAuth")) : null,
      isExam:'',
      mallList: [],
      circleList: [], //相关圈子列表
      is_page_mall: false,
      showModal: false, // 半弹窗判断
      cfg: JSON.parse(localStorage.getItem("cfg")),
      enableShowModuleView: localStorage.getItem("cfg") ? JSON.parse(localStorage.getItem("cfg")).enableShowModuleView : 1,
      enableHiddenModules: localStorage.getItem("cfg") ? JSON.parse(localStorage.getItem("cfg")).enableHiddenModules : [],
    };
  },
  computed: {
    // 判断显示划线价格
    isShowcrossedPrice() {
      return function(item) {
        return !this.$isWxAppIos() && item.crossedPrice && Number(item.crossedPrice) > 0;
      }
    },
    // 获取划线价格
    getCrossedPrice() {
      return function(item) {
        return item.crossedPrice;
      }
    }
  },
  created() {
    utilJs.appShare(this);
  },
  activated() {
    this.isLoading = false;
    this.page = 1;
    this.pagePackage = 1;
    this.pageColumn = 1;
    this.pageMall = 1;
    this.pageCamp = 1;
    this.pageCircle = 1;
    this.searchText = '';
    this.packageList = [];
    this.columnList = [];
    this.mallList = [];
    this.campList = [];
    this.circleList = [];
    this.noHighL = false;
    this.showAll = false;
    this.courseName = "";
    this.noHighL = this.$route.query.noHighL;
    this.showAll = this.$route.query.showAll;
    this.proType = this.$route.query.proType;
    this.proId = this.$route.query.proId;
    this.isExam = this.$route.query.isExam || 0
    this.distributionId = (this.$route.query.distribution && this.$route.query.distribution != 0) ? this.$route.query.distribution : '';
    this.getMore();
    this.companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
    this.isLoading = false;
    if (this.companyAuth.companyNav && this.companyAuth.companyNav.length > 0) {
      let arrPackageFilter = this.companyAuth.companyNav.filter((item) => {
        return item.navType == 18;
      });
      this.showNavBottomBar = arrPackageFilter.length > 0;
    }
    if (this.isExam == this.cfrom.exam || this.isExam == this.cfrom.itemBank || this.isExam == this.cfrom.mutuaTest || this.isExam == this.cfrom.voiceTest) {
      setDocumentTitle("配套课程列表");// eslint-disable-line
    } else if (this.showAll) {
      setDocumentTitle("相关频道列表");// eslint-disable-line
    } else {
      setDocumentTitle("知识套餐列表");// eslint-disable-line
    }
    if (!this.showAll) {
      window.addEventListener('scroll', this.windowScrollFunction);
    }
    this.wechatShare();
  },
  deactivated() {
    this.is_page = false;
    this.is_page_package = false;
    this.is_page_column = false;
    this.is_page_mall = false;
    this.is_page_camp = false;
    this.is_page_circle = false;
    if (!this.showAll) {
      window.removeEventListener('scroll', this.windowScrollFunction);
    }
  },
  mounted() {

  },
  methods: {
    checkCnPrice(payType, price, prodType) {
      return utilJs.checkCnPrice(payType, price, prodType)
    },
    // 半弹窗数据初始化
    initModalData(data) {
      this.showAll = data.showAll || false;
      this.proType = data.proType || -1;
      this.proId = data.proId || -1;
      this.isExam = data.isExam || -1;
      this.showModal = true;
      this.initData();
    },
    initData() {
      this.isLoading = false;
      this.page = 1;
      this.pagePackage = 1;
      this.pageColumn = 1;
      this.pageMall = 1;
      this.pageCamp = 1;
      this.pageCircle = 1;
      this.searchText = '';
      this.packageList = [];
      this.columnList = [];
      this.mallList = [];
      this.campList = [];
      this.circleList = [];
      this.noHighL = false;
      this.courseName = "";
      this.getMore();
    },
    iosAppRouteChange(toPath) {
      if (utilJs.isIOSApp()) {
        window.webkit.messageHandlers.iosWechatRoute.postMessage(toPath);
      } else if (utilJs.isAndoridNewApp()) {
        let data = {
          path: toPath
        }
        window.androidWechatRoute.doAction(JSON.stringify(data))
      } else {
        this.$routerGo(this, "push", { path: toPath });
      }
    },
    startSearch(e) {
      this.page = 1;
      this.packageList = [];
      this.searchText = e.searchValue;
      utilJs.toPageScrollTop();
      this.getMore();
    },
    clickPackageItem(packageId) {
      let toPath = `/homePage/package/packageDetail?combosId=${packageId}&distribution=${this.distributionId}`;
      this.iosAppRouteChange(toPath);
    },
    clickColumnItem(columnId) {
      let toPath = `/homePage/column/columnDetail?cId=-1&ckFrom=${global.ckFrom.column}&extId=${columnId}&distribution=${this.distributionId}`;
      this.iosAppRouteChange(toPath);
    },
    clickMallItem(mgId) {
      let toPath = `/mall/shopDetail/shopDetail?shopNo=${mgId}`;
      this.iosAppRouteChange(toPath);
    },
    clickCampItem(ttId) {
      let toPath = `/homePage/camp/campDetail?campId=${ttId}`;
      this.iosAppRouteChange(toPath);
    },
    clickCircleItem(id) {
      let toPath = `/homePage/circle/circleFeed?id=${id}`;
      this.iosAppRouteChange(toPath);
    },
    getrelatedCampList() {
      let $this = this
      let getUrl = `${global.apiurl}combos/relatedTrainingTermList?`;
      if (this.distributionId) {
        getUrl = `${global.apiurl}distributionMarkets/showAll?`;
      }
      utilJs.getMethod(getUrl + 'proType=' + this.proType + '&proId=' + this.proId + '&page=' + this.pageCamp + '&limit=' + this.limit + '&tabType=' + this.tabType, function (res) {
        $this.isLoading = false;
        $this.courseName = res.name;
        $this.campList = $this.campList.concat(res.list.data);
        $this.pageCamp = res.list.data && (res.list.data.length >= $this.limit) ? ($this.pageCamp + 1) : $this.pageCamp;//res.list.combos.current_page < res.list.combos.last_page ? ($this.pagePackage + 1) : $this.pagePackage;
        $this.is_page_camp = res.list.data && (res.list.data.length >= $this.limit) ? true : false;//res.list.combos.current_page < res.list.combos.last_page ? true : false;
      }, failRes => {
        $this.isLoading = false;
      });
    },
    //相关圈子
    getRelatedCircleList() {
      let getUrl = `${global.apiurl}combos/relatedCircleList?`;
      if (this.distributionId) {
        getUrl = `${global.apiurl}distributionMarkets/showAll?`;
      }
      utilJs.getMethod(`${getUrl}proType=${this.proType}&proId=${this.proId}&page=${this.pageCircle}&limit=${this.limit}&tabType=${this.tabType}`, (res) => {
        this.isLoading = false;
        this.circleList = this.circleList.concat(res.list.data);
        this.pageCircle = res.list.data && (res.list.data.length >= this.limit) ? (this.pageCircle + 1) : this.pageCircle;
        this.is_page_circle = res.list.data && (res.list.data.length >= this.limit) ? true : false;
      }, failRes => {
        this.isLoading = false;
      });
    },
    getrelatedComboList() {
      let $this = this
      let getUrl = `${global.apiurl}combos/relatedComboList?`;
      if (this.distributionId) {
        getUrl = `${global.apiurl}distributionMarkets/showAll?`;
      }
      utilJs.getMethod(getUrl + 'proType=' + this.proType + '&proId=' + this.proId + '&page=' + this.pagePackage + '&limit=' + this.limit + '&tabType=' + this.tabType, function (res) {
        $this.isLoading = false;
        $this.courseName = res.name;
        $this.packageList = $this.packageList.concat(res.list.data);
        $this.pagePackage = res.list.data && (res.list.data.length >= $this.limit) ? ($this.pagePackage + 1) : $this.pagePackage;//res.list.combos.current_page < res.list.combos.last_page ? ($this.pagePackage + 1) : $this.pagePackage;
        $this.is_page_package = res.list.data && (res.list.data.length >= $this.limit) ? true : false;//res.list.combos.current_page < res.list.combos.last_page ? true : false;
      }, failRes => {
        $this.isLoading = false;
      });
    },
    getrelatedColumnList() {
      let $this = this
      let getUrl = `${global.apiurl}combos/relatedColumnList?`;
      if (this.distributionId) {
        getUrl = `${global.apiurl}distributionMarkets/showAll?`;
      }
      utilJs.getMethod(getUrl + 'proType=' + this.proType + '&proId=' + this.proId + '&page=' + this.pageColumn + '&limit=' + this.limit + '&tabType=' + this.tabType, function (res) {
        $this.isLoading = false;
        $this.courseName = res.name;
        $this.columnList = $this.columnList.concat(res.list.data);
        $this.pageColumn = res.list.data && (res.list.data.length >= $this.limit) ? ($this.pageColumn + 1) : $this.pageColumn;//res.list.columns.current_page < res.list.columns.last_page ? ($this.pageColumn + 1) : $this.pageColumn;
        $this.is_page_column = res.list.data && (res.list.data.length >= $this.limit) ? true : false;//res.list.columns.current_page < res.list.columns.last_page ? true : false;
      }, failRes => {
        $this.isLoading = false;
      });
    },
    getrelatedMallList() {
      let $this = this
      let getUrl = `${global.apiurl}combos/relatedGoodList?`;
      utilJs.getMethod(getUrl + 'proType=' + this.proType + '&proId=' + this.proId + '&page=' + this.pageMall + '&limit=' + this.limit + '&tabType=' + this.tabType, function (res) {
        $this.isLoading = false;
        $this.mallList = $this.mallList.concat(res.list.data);
        $this.pageMall = res.list.data && (res.list.data.length >= $this.limit) ? ($this.pageMall + 1) : $this.pageMall;
        $this.is_page_mall = res.list.data && (res.list.data.length >= $this.limit) ? true : false;
      }, failRes => {
        $this.isLoading = false;
      });
    },
    getMore(tabType) {
      if (!this.isLoading) {
        this.isLoading = true;
        let $this = this;
        if (!this.showAll) {
          utilJs.getMethod(global.apiurl + 'combos?name=' + this.searchText + '&page=' + this.page + '&limit=' + this.limit, function (res) {
            $this.isLoading = false;
            $this.packageList = $this.packageList.concat(res.data);
            $this.page = res.data && (res.data.length >= $this.limit) ? ($this.page + 1) : $this.page;//res.current_page < res.last_page ? ($this.page + 1) : $this.page;
            $this.is_page = res.data && (res.data.length >= $this.limit) ? true : false;//res.current_page < res.last_page ? true : false;
          }, failRes => {
            $this.isLoading = false;
          });
        } else {
          if ($this.proType == 1 || $this.proType == 8 || $this.proType == 15 || $this.proType == 5) {
            this.getrelatedColumnList()
          }
          this.getrelatedComboList()
          this.getrelatedCampList()
          this.getrelatedMallList()
          this.getRelatedCircleList();
        }
      }
    },
    //分享
    wechatShare: function () {
      if (this.isTemplate) {
        return;
      }
      let title = this.isExam == this.cfrom.exam || this.isExam == this.cfrom.itemBank || this.isExam == this.cfrom.mutuaTest || this.isExam == this.cfrom.voiceTest ? '配套课程列表' : (this.showAll ? "相关频道列表" : "知识套餐列表");//window.localStorage.getItem("shareTitle");
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`
      if (this.noHighL) {
        shareUrl = `${shareUrl}&noHighL=true&showAll=true&proType=${this.proType}&proId=${this.proId}`
      } else if (this.showAll) {
        shareUrl = `${shareUrl}&showAll=true&proType=${this.proType}&proId=${this.proId}`
      }
      if (this.distributionId) {
        shareUrl = `${shareUrl}&distributionId=${this.distributionId}`;
      }
      utilJs.wechatConfig(shareUrl, title, "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      if (this.isTemplate) {
        return;
      }
      let title = this.isExam == this.cfrom.exam || this.isExam == this.cfrom.itemBank || this.isExam == this.cfrom.mutuaTest || this.isExam == this.cfrom.voiceTest ? '配套课程列表' : (this.showAll ? "相关频道列表" : "知识套餐列表");//window.localStorage.getItem("shareTitle");
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`
      if (this.noHighL) {
        shareUrl = `${shareUrl}&noHighL=true&showAll=true&proType=${this.proType}&proId=${this.proId}`
      } else if (this.showAll) {
        shareUrl = `${shareUrl}&showAll=true&proType=${this.proType}&proId=${this.proId}`
      }
      if (this.distributionId) {
        shareUrl = `${shareUrl}&distributionId=${this.distributionId}`;
      }
      utilJs.appShareTrue(title, "", shareUrl, "");
    },
    windowScrollFunction: function () {
      let that = this;
      utilJs.handleLoading(function () {
        if (that.is_page == true && !that.isTemplate) {
          that.getMore();
        }
      });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style scoped>
</style>


